package ch2.el.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 * 注入app上下文来发布事件
 * 使用applicationcontext来发布
 */
@Component
public class DemoPublisher {
    @Autowired
    ApplicationContext applicationContext;
    public void pulish(String msg){
        applicationContext.publishEvent(new DemoEvent(this,msg));
    }
}
